<%@ page language="java" import="java.util.List" pageEncoding="UTF-8"%>
<%@ page import= "com.roadmap.common.BaseConst"%>
<%@ page import="com.roadmap.struts.action.ActionConst"%>
<%@ page import="com.roadmap.common.RdcResourceBundle" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String user_ssn_id = (String)request.getSession().getAttribute(ActionConst.Aspirant_Id_In_Session);
String user_req_id = request.getParameter(ActionConst.Aspirant_Id_In_Request);
if(user_req_id == null){
	user_req_id = user_ssn_id;
}
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/> 
<link href="res/css/layout.css" rel="stylesheet" type="text/css" media="all" />
<link href="res/css/sns.css" rel="stylesheet" type="text/css" media="all" />
<link href="res/css/widget.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="dwr/util.js"></script>
<script type="text/javascript" src="dwr/engine.js"></script>
<script type="text/javascript" src="dwr/interface/RdcAjax.js"></script>
<script type="text/javascript" src="res/js/func.js"></script>
<script type="text/javascript" src="res/js/widget.js"></script>
<script type="text/javascript" src="res/js/component.js"></script>
<title>查询结果 | <%=RdcResourceBundle.COMPANY_NAME %></title>

</head>

<body>
	<jsp:include page="/admin/myheader.jsp"></jsp:include>
	
	<!-- define the frame for logging on-->
	<div class="mainbody"><div class="manager">
	<jsp:include page="/admin/sns/nav_btns.jsp"/>
	
	<!-- middle part: content -->
	<div class="middle-part">
		<logic:equal name="fromAction" value="search">
		<div class="section">
			<div class="title-sp">查询结果</div><br/><br/>
			<span class="prompt-message">如果没找到您想要的结果，可以<a href="searchFriends.do?act=view">重新查找</a></span>
			
			<logic:present name="people">
			<div class="spec">返回<strong><%=((List)request.getAttribute("people")).size() %></strong>个结果</div>
			<div class="friendlist">
				<ul>
					<logic:iterate id="person" name="people">
					<bean:define id='personId' name='person' property='id'/>
					<bean:define id='personName' name='person' property='realName'/>
					<li>
						<div class="smallpicture"><img src="<%=BaseConst.PURIKURA_DIR_SMALL%><%=personId %>.gif" alt="<%=RdcResourceBundle.COMPANY_NAME %>"/></div>
						<div class="friend">
							<ul> 
								<li><img src="res/images/logo/sex_10_<bean:write name='person' property='sex'/>.png"/>&nbsp;<a href="aspirant.do?uid=<%=personId %>"><%=personName%></a></li>
								<% if(user_ssn_id != null && !user_ssn_id.equals(personId)){%>
								<li><a href="javascript:sendRequest('<%=personId %>', '<%=personName%>');" title='加为好友'><img src="res/images/logo/connect_16.png"/></a>&nbsp;&nbsp;&nbsp;
									<!-- <a href="javascript:void(0);" title="发送消息"><img src="res/images/logo/message_16.png"/></a> -->
								</li>
								<%} %>
							</ul>
						</div>
					</li>
					</logic:iterate>
				</ul>
			</div>
			</logic:present>
		</div>
		<script>document.title="查询结果";</script>
		</logic:equal>
		
		<logic:equal name="fromAction" value="friend">
		<div class="section">
			<div class="title-sp"><a href="aspirant.do?uid=<%=user_req_id %>"><bean:write name="<%=ActionConst.Aspirant_Name_In_Request %>"/></a>的好友</div><br/><br/>
			<logic:notPresent name="friends"><span><bean:write name="<%=ActionConst.Aspirant_Name_In_Request %>"/>还没有好友</span></logic:notPresent>
			
			<logic:present name="friends">
			<div class="spec"><strong><%=((List)request.getAttribute("friends")).size() %></strong>个好友</div>
			<div class="friendlist">
				<ul>
					<logic:iterate id="friend" name="friends">
					<bean:define id='fid' name='friend' property='friendId'/>
					<bean:define id='fname' name='friend' property='name'/>
					<li>
						<div class="smallpicture"><img src="<%=BaseConst.PURIKURA_DIR_SMALL%><%=fid %>.gif" alt="<%=RdcResourceBundle.COMPANY_NAME %>"/></div>
						<div class="friend">
							<ul> 
								<li><a href="aspirant.do?uid=<%=fid %>"><%=fname%></a></li>
								<% if(user_ssn_id != null && !user_ssn_id.equals(fid)){%>
								<li><a href="javascript:sendRequest('<%=fid %>', '<%=fname%>');" title='加为好友'><img src="res/images/logo/connect_16.png"/></a>&nbsp;&nbsp;&nbsp;
									<a href="javascript:void(0);" title="发送消息"><img src="res/images/logo/message_16.png"/></a>
								</li>
								<% } %>
							</ul>
						</div>
					</li>
					</logic:iterate>
				</ul>
			</div>
			</logic:present>
		</div>
		<script>document.title="<bean:write name='<%=ActionConst.Aspirant_Name_In_Request %>'/>的好友";</script>
		</logic:equal>
		
		<logic:equal name="fromAction" value="visit">
		<div class="section">
			<div class="title-sp"><a href="aspirant.do?uid=<%=user_req_id %>"><bean:write name="<%=ActionConst.Aspirant_Name_In_Request %>"/></a>的好友来访纪录</div><br/><br/>
			<logic:notPresent name="visitors"><span class="prompt-message">暂时没有好友来访</span></logic:notPresent>
			
			<logic:present name="visitors">
			<div class="spec"><strong><%=((List)request.getAttribute("visitors")).size() %></strong>个好友访问过</div>
			<div class="friendlist">
				<ul>
					<logic:iterate id="visitor" name="visitors">
					<bean:define id='vid' name='visitor' property='id'/>
					<bean:define id='vname' name='visitor' property='name'/>
					<li>
						<div class="smallpicture"><img src="<%=BaseConst.PURIKURA_DIR_SMALL%><%=vid %>.gif" alt="<%=RdcResourceBundle.COMPANY_NAME %>"/></div>
						<div class="friend">
							<ul> 
								<li><a href="aspirant.do?uid=<%=vid %>"><%=vname%></a></li>
								<li><bean:write name='visitor' property='createdTime' format='yyyy.MM.dd HH:mm'/></li>
								<% if(user_ssn_id != null && !user_ssn_id.equals(vid)){%>
								<!-- <li><a href="javascript:void(0);" title="发送消息"><img src="res/images/logo/message_16.png"/></a></li> -->
								<% } %>
							</ul>
						</div>
					</li>
					</logic:iterate>
				</ul>
			</div>
			</logic:present>
		</div>
		<script>document.title="<bean:write name='<%=ActionConst.Aspirant_Name_In_Request %>'/>的好友来访纪录";</script>
		</logic:equal>
	</div>
	
	<!-- right part: -->
	<div class="right-part">
	</div>
	
	</div>
	
	<div class="clear-div"></div>
	</div>
	
	<jsp:include page="/res/jsp/footer.jsp"></jsp:include>

<script type="text/javascript">
	var reqPopup = new SendRequestPopup();
	function sendRequest(uid, uname){
		reqPopup.setData(uid, uname);
		reqPopup.show();
	}
</script>

</body>

</html>
